select * from ClassInfo
select * from StuInfo

update StuInfo set cid = 1000

select * from StuInfo,ClassInfo where StuInfo.cid = ClassInfo.Id
go
create proc del_class @id int
as
	begin tran
	declare @error int = 0
	delete from StuInfo where cid = @id
	set @error += @@error
	delete from ClassInfo where id = @id
	set @error += @@error

	if @error<>0
		rollback
	else
		commit
go

exec del_class 1000